package com.submit.demo.service.impl;

import com.submit.demo.config.MinIOProperties;
import com.submit.demo.service.FileService;
import com.submit.demo.util.MinIOUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;

@Service
public class FileServiceImpl implements FileService {
    @Autowired
    private MinIOProperties minIOProperties;

    @Override
    public void download(HttpServletResponse response, String filename) {
        MinIOUtil.download(minIOProperties.getBucketName(), filename, response);
    }

    @Override
    public void zipDownload(HttpServletResponse response, String[] names) {
        MinIOUtil.zipDownload(minIOProperties.getBucketName(), names, response);
    }
}
